<%= javascript_include_tag "prototype" %>
<div id="bodyPan">

<h1>Search Results</h1>

<% if @results.nil? || @results.empty? %>
  <div id="nosearchresults"> Search resulted in 0 results! </div>
<% else %>
  <div><%= "#{@results.length} results found!" %></div>
  <div style="border:grey 1px solid">
  <table id="resultstable" width="100%" align="center">
      <tr>
        <th>Title</th>
        <th># of Views</th>
        <th>Last Updated</th>
      </tr>
      <% i = 0 %>
      <% for webcomic in @results %>
        <% if i % 2 == 0 %>
          <% x = "even" %>
        <% else %>
          <% x = "odd" %>
        <% end %>
      <tr>
      <%= "<td class=\"" + x + "\" width=\"70%\">"%>
        <%= link_to webcomic.title, webcomic%>
      </td>
      <%= "<td class=\"" + x + "\" width=\"15%\">"%>
        <%= webcomic.number_of_views %>
      </td>
      <%= "<td class=\"" + x + "\" width=\"15%\">"%>
        <%= webcomic.updated_at.localtime.strftime("%m-%d-%Y") %>
      </td>
    </tr>
    <% i += 1 %>
    <% end %>
  </table>
  </div>
<% end %>
<br />
<br />
<div align="left"><%= button_to "New Search", :controller => "webcomics", :action => "search" %></div>
</div>